function main() {

    const self = this;
    debugger
    const formEle = self.$$("form_part_1ynuqm").$$getRenderElement();
    const taskId = self.$$getRouteView().$$getRenderElement().extraParams.taskId;
    const objectName = self.$$getRouteView().$$getRenderElement().extraParams.objectName;

    formEle.onSave().then(res => {
        const law_std_sup_task = "ds_tbl:t_91f06a36e9df4bf0981df72a4a2417f2";
        api.EXEC_FORMULA("UPDATE('" + law_std_sup_task + "', QUERY_EQ('id', '" + taskId + "'), '', ['status', '" + 4 + "'])").then(() => {
            let username = api.USER_INFO().name;

            let handleRecord = {
                replyId: taskId,
                recordType: 2,
                recordTitle: "督办反馈",
                recordContent: `${objectName}受理员${username}反馈了督办事项结果。`,
                relationReplyId: res.result['ds_tbl:t_3650c122dc4d44b7bc004c6f74bda62d'].id
            }
            insertHandleRecord(handleRecord).then(r => {
                let pageListEle = window.taskPageList;
                // 获取列表渲染页实例
                const listRenderView = pageListEle.$$getRenderElement();
                // 获取当前显示的组件，表格或者卡片
                const currentListEle = listRenderView.$$getListElement();
                // 调用刷新方法
                currentListEle.$$refreshData();
                notifyParentAndClose(self)
            });
        });
    })

}

/**
 * 处理经过
 * @param recordData
 * @returns {Promise<unknown>}
 */
function insertHandleRecord(recordData) {

    const insertHandleRecords = [
        ['record_uid', 'UUID()'],
        ['relation_id', `'${recordData.replyId}'`],
        ['record_type', `'${recordData.recordType}'`],
        ['record_title', `'${recordData.recordTitle}'`],
        ['record_content', `'${recordData.recordContent}'`],
        ['create_time', 'NOW()'],
        ['create_human_id', 'USER_ID()'],
        ['relation_reply_id', `'${recordData.relationReplyId}'`]
    ];

    const formattedFields = insertHandleRecords.map(([key, value]) => {
        return `'${key}',${value}`;
    });

    const law_std_sup_handle_record = "ds_tbl:t_0ff47ea0e3a74ffdbc274409e7103e7e";
    const insertSql = `INSERT('${law_std_sup_handle_record}', [${formattedFields.join(',')}])`;
    console.log(insertSql);


    return new Promise((resolve, reject) => {
        api.EXEC_FORMULA(insertSql).then(res => {
            console.log(res);
            resolve(res);
        })
    })

}

function notifyParentAndClose(self) {
    const pageRenderElement = self.$$root().$parent.$parent.$parent;
    if (window.parent) {
        window.parent.postMessage(
            JSON.stringify({ event: "close-dialog", param: { XXX: "test" } }),
            "*"
        );
    }
}
